package org.wz.complex.work.bean;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Res {

    @Builder.Default
    private Integer code = 200;

    @Builder.Default
    private String message = "成功！";

    private Object data;


    public static Res ok(Object data) {
        return Res.builder().code(200).message("ok").data(data).build();
    }

    public static Res fail(String message) {
        return Res.builder().code(500).message(message).data(null).build();
    }

}

